#pragma once

#include<iostream>
#include<string>
#include"Addr.hpp"
#include<functional>

using ft = std::function<std::string(std::string&)>;
class Reactor;



class Connection
{
public:
    Connection():_sockfd(-1),owner(nullptr)
    {}

    virtual void Recv() = 0;
    virtual void Send() = 0;
    virtual void Expect() = 0;

    virtual ~Connection()
    {}

    int Sockfd()
    {
        return _sockfd;
    }

    void SetEvents(uint32_t event)
    {
        _events = event;
    }

    uint32_t GetEvents()
    {
        return _events;
    }

    void SetOwner(Reactor* const _this)
    {
        owner = _this;
    }

    Reactor* GetOwner()
    {
        return owner;
    }

    



protected:
    int _sockfd;
    Inet_Addr _Client;
    std::string _inbuffer;
    std::string _outbuffer;
    ft _ft;

private:
    


    uint32_t _events;

    Reactor* owner;
};